package package06章_面向对象编程_基础._08constructor.exer1;/**
 * ClassName: Student
 * Package: package06章_面向对象编程_基础._08constructor.exer1
 * Description:
 *
 * @Author lys
 * @Create 2024/2/17 10:10
 * @Version 1.0
 */

/**
 * @author lys
 * @version 1.0
 * @description: *
 * *  (1)定义Student类,有4个属性：
 * *   String name;
 * *   int age;
 * *   String school;
 * *   String major;
 * *
 * * (2)定义Student类的3个构造器:
 * *
 * * - 第一个构造器Student(String n, int a)设置类的name和age属性；
 * * - 第二个构造器Student(String n, int a, String s)设置类的name, age 和school属性；
 * * - 第三个构造器Student(String n, int a, String s, String m)设置类的name, age ,school和major属性；
 * @date 2024/2/17 10:10
 */
public class Student {

    String name;
    int age;
    String school;
    String major;//专业

    public Student(String n, int a) {
        name = n;
        age = a;
    }

    public Student(String name, int age, String school) {
        this.name = name;
        this.age = age;
        this.school = school;
    }

    Student(String n, int a, String s, String m) {
        name = n;
        age = a;
        school = s;
        major = m;
    }

    public String getInfo() {
        return "name = " + name + ",age = " + age +
                ",school = " + school + ", major = " + major;
    }
}
